package com.vim.modules.configServer.service;

import com.github.pagehelper.PageInfo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.vim.modules.configServer.model.Config;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
* @作者 Administrator
* @时间 2019-09-19 10:55:47
* @版本 1.0
* @说明
*/
@FeignClient(value = "template-config-server", fallback = ConfigServiceHystrix.class)
public interface ConfigService {

    /**
     * 获取配置列表
     */
    @RequestMapping(value = "/configServer/dataList",method = RequestMethod.GET)
    PageInfo<Config> findPageList(@RequestParam(value = "pageNum") Integer pageNum,
                                  @RequestParam(value = "pageSize") Integer pageSize,
                                  @RequestBody Config config);

    /**
     * 获取配置信息
     */
    @RequestMapping(value = "/configServer/get",method = RequestMethod.GET)
    Config get(@RequestParam(value = "id") String id);

    /**
     * 更新配置信息
     */
    @RequestMapping(value = "/configServer/saveOrUpdate",method = RequestMethod.POST)
    Map<String, Object> saveOrUpdate(@RequestBody Config config);

    /**
     * 推送配置
     */
    @RequestMapping(value = "/configServer/sendConfig",method = RequestMethod.POST)
    @HystrixCommand
    Map<String, Object> sendConfig(@RequestParam(value = "id") String id);
}